package com.kmxd.ams.app.event.copy;

import com.kmxd.ams.app.event.copy.command.VolumeCopyCmd;
import com.kmxd.ams.client.event.copy.CopyVolumeEvent;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import org.springframework.transaction.event.TransactionalEventListener;

/**
 * 复制案卷文件监听实现
 *
 * @author nickbi
 */
@Slf4j
@Component
@AllArgsConstructor
public class CopyVolumeListener {
  private final VolumeCopyCmd volumeCopyCmd;

  @TransactionalEventListener(fallbackExecution = true)
  public void buildCatalog(CopyVolumeEvent event) throws Exception {
    volumeCopyCmd.copy(event.getReq(), event.getSaToken());
  }
}
